namespace SilverSea.Untilities
{
    using Microsoft.Win32;
    using System;
    using System.Data;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    public class SoundPlayer
    {
        private RegistryKey registryKey_0;
        private RegistryKey registryKey_1;

        private PropertyCollection method_0()
        {
            string name = @"AppEvents\Schemes\Apps\.Default";
            PropertyCollection propertys = new PropertyCollection();
            try
            {
                this.registryKey_0 = Registry.CurrentUser.OpenSubKey(name, false);
                foreach (string str2 in this.registryKey_0.GetSubKeyNames())
                {
                    this.registryKey_1 = this.registryKey_0.OpenSubKey(str2 + @"\.Current", false);
                    if ((this.registryKey_1 != null) && (this.registryKey_1.GetValue(null).ToString().Length > 0))
                    {
                        propertys.Add(str2, this.registryKey_1.GetValue(null).ToString());
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Yikes!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            finally
            {
                this.registryKey_0.Close();
                this.registryKey_1.Close();
            }
            return propertys;
        }

        public bool Play(string fileName)
        {
            return PlaySound(fileName, IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
        }

        [DllImport("winmm.dll", SetLastError=true)]
        private static extern bool PlaySound(string string_0, IntPtr intptr_0, SoundFlags soundFlags_0);

        public enum SoundFlags
        {
            SND_ALIAS = 0x10000,
            SND_ALIAS_ID = 0x110000,
            SND_ASYNC = 1,
            SND_FILENAME = 0x20000,
            SND_LOOP = 8,
            SND_MEMORY = 4,
            SND_NODEFAULT = 2,
            SND_NOSTOP = 0x10,
            SND_NOWAIT = 0x2000,
            SND_RESOURCE = 0x40004,
            SND_SYNC = 0
        }
    }
}

